<!--
 * @Descripttion: 内容设置
 * @Author: xiao li
 * @Date: 2020-07-06 12:17:07
 * @LastEditors: xiao li
 * @LastEditTime: 2021-04-29 13:48:33
-->
<template>
    <div class="lb-group-setting">
        <top-nav></top-nav>
        <div class="page-main">
            <el-form @submit.native.prevent :model="settongForm" :rules='settongFormRules' ref='settongForm' label-width="140px">
                <el-form-item label="销售管家" prop="btn_sale">
                    <el-input v-model="settongForm.btn_sale" placeholder="请输入内容"></el-input>
                    <lb-tool-tips>员工端-消息-销售管家文字显示内容</lb-tool-tips>
                </el-form-item>
                <el-form-item>
                    <lb-button type='primary' @click="submitFormInfo('settongForm')">{{$t('action.submit')}}</lb-button>
                </el-form-item>
            </el-form>
        </div>
    </div>
</template>

<script>
export default {
  data () {
    return {
      settongForm: {
        btn_sale: ''
      },
      settongFormRules: {
        btn_sale: {required: true, type: 'string', message: '请输入内容', trigger: 'blur'}
      }
    }
  },
  created () {
    this.getFormInfo()
  },
  methods: {
    submitFormInfo (name) {
      this.$refs[name].validate(valid => {
        if (valid) {
          this.$api.appSettingMsgContent(this[name]).then(res => {
            console.log(res)
            if (res.code === 200) {
              this.$message.success(this.$t('tips.successSub'))
            }
          })
        }
      })
    },
    getFormInfo () {
      this.$api.getAliyunInfo().then(res => {
        if (res.code === 200) {
          this.settongForm.btn_sale = res.data.btn_sale
        }
      })
    }
  }
}
</script>

<style lang="scss" scoped>
    .lb-group-setting{
        width: 100%;
        .page-main{
            .el-input{
                width: 300px;
            }
        }
    }
</style>
